#! /bin/usr/env python
# ecoding = utf-8
__author__ = 'lihao'
import numpy as np
import pylab
import scipy.stats as stats
import urllib2
import sys
target_url = ("https://archive.ics.uci.edu/ml/machine-learning-databases/undocumented/connectionist-bench/sonar/sonar.all-data")
data = urllib2.urlopen(target_url)
xList = []
labels = []
for line in data:
    row = line.strip().split(",")
    xList.append(row)
nrow = len(xList)
ncol = len(xList[1])
sys.stdout.write("Number of Rows of Data = " + str(nrow) + '\n')
sys.stdout.write("Number of Columns of Data = " + str(ncol) + '\n')

type = [0] * 3
colCounts = []

col = 3
colData = []
for row in xList:
    colData.append(float(row[col]))

stats.probplot(colData, dist="norm", plot=pylab)
pylab.show()